def remove_digits(num_str, k):
    stack = []
    for char in num_str:
        while stack and k > 0 and stack[-1] > char:
            stack.pop()
            k -= 1
        stack.append(char)
    
    # If still need to remove more digits, remove from the end
    stack = stack[:len(stack)-k] if k > 0 else stack
    
    return ''.join(stack).lstrip('0') or '0'

if __name__ == "__main__":
    with open('input.txt', 'r') as file:
        data = file.readlines()
    num_str = data[1].strip()
    k = int(data[0].strip())
    
    result = remove_digits(num_str, k)
    with open('output.txt', 'w') as file:
        file.write(result)
